package cn.tedu.stage2.thread;

/*
 * 多线程可以并发执行多个代码块
 *
 * 线程的第一种创建方法：
 * 继承Thread重写run方法
 */
public class ThreadDemo1 {
    public static void main(String[] args) {
        MyThread1 t1 = new MyThread1();
        MyThread2 t2 = new MyThread2();
        t1.start();
        t2.start();
    }
}

class MyThread1 extends Thread{
    public void run(){
        for (int i=0;i<1000;i++){
            System.out.println("你是谁呀！");
        }
    }
}

class MyThread2 extends Thread{
    public void run(){
        for (int i=0;i<1000;i++){
            System.out.println("开门！查水表的");
        }
    }
}
